<?php
$this->template->add_css_lib("myscorespresenter.css");
$this->template->add_js_lib("play_game.js");
$this->template->add_js_lib("lights.js");
?>
<div id="content_game">
<div class="breadcrumbs"> <span> <a title="Go to Game Hay Nhất." href="<?php echo base_url(); ?>" class="home">Game Hay Nhất</a> &gt;
  <?php 
	if (isset($parent_cate) && $parent_cate) {
		echo '<a title="Xem danh mục ',  $parent_cate->cat_name ,'" href="',  category_url($parent_cate->cat_code),'" class="category cate-',$parent_cate->cat_code,'">',  $parent_cate->cat_name ,'</a> &gt; ';
	}
	?>
  <?php 
		if (isset($cate) && $cate) {
			echo '<a title="Xem danh mục ',  $cate->cat_name ,'" href="',  category_url($cate->cat_code),'" class="category cate-',$cate->cat_code,'">',  $cate->cat_name ,'</a> &gt; ';
		}
	?>
  <?php echo $game->game_title; ?> </span> </div>
<div class="clear" style="height:10px"></div>
<!-------------->
<div style="min-height: 455px;">
  <div id="intro"> <img src="<?php echo $this->template->url_theme;?>images/logoplay.png" />
    <div id="showprogressbar" style="display:block; margin:0px;">
      <div id="progressbar" style="margin-left: 146px;"> <span id="progresstext">0%</span>
        <div id="progressbarloadbg" style="z-index: 2; transition: width 5s;">&thinsp;</div>
      </div>
    </div>
    <div id="progressbarloadtext" onclick="window.hide();"> Tải game hoàn tất, chơi game ngay! </div>
  </div>
  <div class="clear"></div>
  <div id="my_game" style="height: 100%; width: 100%; display: none;">
    <div id="escenario">
      <div id="play_game">
        <div id="bordeswf">
          <embed id="playgame" src="<?php echo image_src($game->game_file ); ?>" wmode="transparent" menu="false" quality="high" width="670" height="<?php echo ($game->game_file_rate_height_width*670);?>" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> 
        </div>
      </div>
      <div id="game_buttons"> <a href="javascript:void(0)" id="replay_game" class="choilai">Chơi lại</a> <span class="molon" id="game_out" ><a href="javascript:void(0)" onclick="javascript:change_screen_game_player(0);">Mở lớn</a></span> <span id="game_in" class="thunho" ><a href="javascript:void(0)" onclick="javascript:change_screen_game_player(1);">Thu nhỏ</a></span> <a href="#" title="Tắt/mở nền" class="interruptor"><img src="<?php echo $this->template->url_theme;?>images/blank.png" border="0" alt="Lights Toggle"> Tắt/mở nền</a> <a href="javascript:void(0);" onclick=content"javascript:AccountInteractiveToGamePlayer('failure_update');" title="Báo lỗi game" class="baoloi">Báo lỗi</a>
        <?php if (is_module_active('user_game_favorites_module') &&  function_exists('run_widget')) run_widget('user_game_favorites_module', array(
				'view'=> 'add',
				'game_id'=> $game->game_id,
			)); ?>
        <?php //			<a class="thachdau">Thách đấu</a> ?>
      </div>
      <div class="clear"></div>
    </div>
  </div>
</div>
</div>

<script>
<?php if($msg !='') {
	echo 'alert("'.$msg.'");';
} ?>
</script> 
<script type="text/javascript">
function change_screen_game_player(pid) {
	$("#game_out").click(function() {
		embed = $('#playgame').animate();
		embed_ie = $('#playgame_ie').animate();
		var max_width = 800;
		var ar = embed.width()/embed.height(); 
		var ar_ie = embed_ie.width()/embed_ie.height(); 
		$('#playgame').attr('width', max_width);
		$('#playgame').attr('height', max_width/ar);
		// Xu ly mo rong tren IE
		$('#playgame_ie').attr('width', max_width);
		$('#playgame_ie').attr('height', max_width/ar_ie);
		
		$("#content_game").attr("id", "content_game-full");
		//$('.centerBox-o-c-gamePage-gameplay').attr("class", "centerBox-o-c-gamePage-gameplay-full-1004");
		$('#game_out').hide();
		$('#game_in').show();
	});
	$("#game_in").click(function() {
		//var v_width = $("#hnd_width").val();
		embed = $('#playgame').animate();
		var max_width = 670;
		var ar = embed.width()/embed.height(); 
		var ar_ie = embed_ie.width()/embed_ie.height(); 
		$('#playgame').attr('width', max_width);
		$('#playgame').attr('height', max_width/ar);
		
		// Xu ly thu nho tren IE
		$('#playgame_ie').attr('width', max_width);
		$('#playgame_ie').attr('height', max_width/ar_ie);
		
		$("#content_game-full").attr("id", "content_game");
		//$('.centerBox-o-c-gamePage-gameplay-full-1004').attr("class", "centerBox-o-c-gamePage-gameplay");
		$('#game_out').show();
		$('#game_in').hide();
	});
}
</script>